package com.java0.sharddbtables.repository;

import com.java0.sharddbtables.entity.Node;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author L.xf
 * @date 2021/10/30
 */
@Mapper
public interface NodeMapper {

    @Select("SELECT * FROM t_node")
    List<Node> findAll();

    @Insert({"insert into t_node(name, uid) values(#{name},#{uid})"})
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int save(Node node);
}
